#ifndef ADLOGIC
#define ADLOGIC
#include "cJSON.h"

#include "glib.h"
#include "gio/gio.h"
#include <stdio.h>
#include "curlRequest.h"
#define RES_PATH "/home/hsh/ronghuanet_ads/resources/"
    typedef struct AdResource
    {
        int id;
        int ad_id;
        int type_id;
        char *path;
        char *sign;
        int index;
    }AdResource;
    typedef struct Ad
    {
        int id;
        int template_id;
        int customer_id;
        char *start_time;
        char *end_time;
        int state;
        int index;
        AdResource *adResources[3];
    }Ad;
    Ad* parseUpDownSplitScr(cJSON *adJson);
    char* getResPath(AdResource *ar);
    int downloadAdsAndUpdateLocalAdListToSqlite(Ad* ads[],int size);
    void handleAdList(cJSON *adListArray);
    void *parseCmd(cJSON *cmdList);
#endif